package com.codetree.strategy.simple.if_example;

import com.codetree.strategy.common.Constant;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

@Slf4j
@Service
public class IfPaymentServiceImpl implements IfPaymentService {
    @Override
    public String pay(String type, BigDecimal amount) {
        if (Constant.PAYConstant.ALI_PAY.equals(type)) {
            return "支付宝支付成功，金额：" + amount;
        } else if (Constant.PAYConstant.WECHAT_PAY.equals(type)) {
            return "微信支付成功，金额：" + amount;
        } else if (Constant.PAYConstant.UNION_PAY.equals(type)) {
            return "银联支付成功，金额：" + amount;
        }
        throw new IllegalArgumentException("无效支付方式");
    }
}
